#include <bits/stdc++.h>
#define int long long
using namespace std;
inline int read()
{
    int ans = 0, f = 0;
    char c = getchar();
    while (!isdigit(c))
        f |= c == '-', c = getchar();
    while (isdigit(c))
        ans = (ans << 3) + (ans << 1) + c - 48, c = getchar();
    return f ? -ans : ans;
}
void write(int x)
{
    if (x < 0)
        putchar('-'), x = -x;
    if (x > 9)
        write(x / 10);
    putchar(48 + x % 10);
}
const int N = 1e5 + 5, mod = 998244353;
int n, k, ans, to[N];
int top, sta[N], vis[N];
inline int qpow(int x, int p)
{
    int ans = 1;
    while (p)
    {
        if (p & 1)
            ans = ans * x % mod;
        x = x * x % mod, p >>= 1;
    }
    return ans;
}
void dfs(int u, int col)
{
    sta[++top] = u, vis[u] = col;
    if (vis[to[u]])
    {
        if (vis[to[u]] == col)
        {
            int len = 0;
            while (sta[top + 1] != to[u])
                ++len, --top;
            ans = (ans + qpow(len, k)) % mod;
        }
        return;
    }
    dfs(to[u], col);
}
void Try(int u)
{
    if (u == n + 1)
    {
        for (int i = 1; i <= n; ++i)
            vis[i] = 0;
        for (int i = 1; i <= n; ++i)
            if (!vis[i])
            {
                top = 0;
                for (int j = 1; j <= n; ++j)
                    sta[j] = 0;
                dfs(i, i);
            }
        return;
    }
    for (int i = 1; i <= n; ++i)
        to[u] = i, Try(u + 1);
}
signed main()
{
    freopen("length.in", "r", stdin);
    freopen("length.out", "w", stdout);
    n = read(), k = read();
    Try(1);
    write(ans);
    return 0;
}